<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
	<title>修改菜单</title>
	<%@ include file="/common/common_style_script.jsp"%>
</head>
<body>
	<form id="formEdit" action="<c:url value="/sys/menu/doUpdate.action"/>" 
		class="cf wd5 fl" target="_top">
		<input type="hidden" name="menuItem.menuItemId" value="${requestScope.id}"/>
		<div>
			<label for="menuItemCode">菜单编号</label>
			<input id="menuItemCode" name="menuItem.menuItemCode" value="<c:out value="${menuItem.menuItemCode}"/>" />
		</div>
		<div>
			<label for="menuItemName">菜单名称</label>
			<input id="menuItemName" name="menuItem.menuItemName" value="<c:out value="${menuItem.menuItemName}"/>" />
		</div>
        <div>
        	<label for="superMenuItem">上级菜单</label>
        	<s:select id="superMenuItem" name="menuItem.superMenuItem.menuItemId" list="menuItemList" listKey="menuItemId" listValue="menuItemName" headerKey="-1" headerValue="-- 请选择 --" value="menuItem.superMenuItem.menuItemId"></s:select>
        </div>
        <div>
        	<label for="menuItemTarget">菜单描述</label>
            <textarea id="menuItemTarget" name="menuItem.menuItemTarget" cols="100"><c:out value="${menuItem.menuItemTarget}"/></textarea>
        </div>
        <div class="btn">
            <input id="btnSave" type="button" value="确定"/>
            <input id="btnCancel" type="button" value="取消"/>
        </div>
    </form>
</body>
<script>
$(function(){
	$("#btnSave").click(function(){
		//$("#formEdit").submit();
		var params = $('#formEdit').serialize();
		$.ajax({
			type:'POST',
			dataType:'json',
			url:'<c:url value="/ajax/menu/doUpdate.action"/>',
			data:params,
			success:function(data){
				if(data.success) {
					alert('保存成功');
					var id = data.id;
					parent.frames['left'].location.reload();
					location.href = '<c:url value="/sys/menu/toAction/view.action?id="/>' + id;
				} else {
					alert('操作失败，原因：' + result.exception);
				}
			}
		});
	});
	$("#btnCancel").click(function(){
		history.go(-1);
	});
});
</script>
</html>